#include<iostream>
#include<vector>
#include<string>
using namespace std;
#define A2B 0
#define B2A 1
#define EMPTY_A 2
#define EMPTY_B 3
#define FILL_A 4
#define FILL_B 5
#define SUC 6
bool record[1001][1001];
string signal[8]={
"pour A B",
"pour B A",
"empty A",
"empty B",
"fill A",
"fill B",
"success"
};

struct state{
   int size_a;
   int size_b;
   int a;
   int b;
   int step;
   int parent;
   int id;
   int from;
   bool opened;
};
void clean(){
     for(int i=0;i<1001;i++){
             for(int j=0;j<1001;j++){ 
                     record[i][j] = false;
             }
    }     
}
state pour(int direction,const state &currentState ){
      state newState;
      if(direction = A2B){
                   // if B is full
                   if(currentState.b == currentState.size_b){
                         //do nothing
                         newState.a = currentState.a;
                         newState.b = currentState.b;
                   }
                   else{
                         if( currentState.b + currentState.a >currentState.size_b){
                             newState.a = currentState.a - (currentState.size_b - currentState.b);
                             newState.b = currentState.size_b;
                         }else{
                               newState.a = 0;
                               newState.b = currentState.b+currentState.a;
                         }
                   }
                   newState.from = A2B;
      }
      else{
           if(currentState.a == currentState.size_a){
               //do nothing
                newState.a = currentState.a;
                newState.b = currentState.b;
           }
           else{
               if( currentState.a + currentState.b >currentState.size_a){
                   newState.b = currentState.b - (currentState.size_a - currentState.a);
                   newState.a = currentState.size_a;
               
               }else{
                   newState.b = 0;
                   newState.a = currentState.a+currentState.b;
               }
           }
           newState.from = B2A;
      }
      newState.opened = false;
      newState.parent = currentState.id;
      newState.step = currentState.step + 1;
      newState.size_a = currentState.size_a;
      newState.size_b = currentState.size_b;
      return newState;
}
state empty(int ab,const state &currentState){
      state newState;
      if(ab == EMPTY_A){
            newState.from = EMPTY_A;
            newState.a = 0;
            newState.b = currentState.b;
      }else{
            newState.from = EMPTY_B;
            newState.b = 0;
            newState.a = currentState.a;
      }
      newState.step = currentState.step +1 ;
      newState.size_a = currentState.size_a;
      newState.size_b = currentState.size_b;
      newState.parent = currentState.id;
      newState.opened = false;
      return newState;
}
state fill(int ab,const state &currentState){
      state newState;
      if(ab == FILL_A){
            newState.a = currentState.size_a;
            newState.b = currentState.b;
            newState.from = FILL_A;
      }else{
            newState.a = currentState.a;
            newState.b = currentState.size_b;
            newState.from = FILL_B;
      }
      newState.step = currentState.step +1 ;
      newState.size_a = currentState.size_a;
      newState.size_b = currentState.size_b;
      newState.parent = currentState.id;
      newState.opened = false;
      return newState;
}
state makeState(int size_a,int size_b,int id = 0,int a=0,int b=0,int parentid = 0,int step = 0){
      state s;
      s.size_a = size_a;
      s.size_b = size_b;
      s.step = 0;
      s.a = a;
      s.b = b;
      s.id = id;
      s.parent = parentid;
      s.opened = false;
      s.from = SUC;
      return s;
}


bool isGoal(state &s,const int& goal){
     if(s.b == goal){
           return true;
     }else{
           return false;
     }
}
bool nextState(state &currentState,vector<state>& stateV,const int &goal){
       currentState.opened = true;
       state *newState = new state[6];
       
       newState[A2B] = pour(A2B,currentState);
       newState[B2A] = pour(B2A,currentState);
       newState[EMPTY_A] = empty(EMPTY_A,currentState);
       newState[EMPTY_B] = empty(EMPTY_B,currentState);
       newState[FILL_A] = fill(FILL_A,currentState);
       newState[FILL_B] = fill(FILL_B,currentState);
       int start = stateV.size();
       for(int i=0;i<6;i++){
           if(record[newState[i].a][newState[i].b] == false){
               record[newState[i].a][newState[i].b] = true;
               newState[i].id = start;
               start++;
               newState[i].parent = currentState.id;
               stateV.push_back(newState[i]);
               if(isGoal(newState[i],goal))return true;
           }
       }
       return false;
}

int main(){
    int size_a,size_b,goal;
    while(cin>>size_a>>size_b>>goal){
        state originalState = makeState(size_a,size_b,0,0,0,0,0);
        clean();
        vector<state> v;
        v.push_back(originalState);
        bool flag = false;
        while(true){
            
            int end = v.size()-1;
            for(int i = end ; i>=0 ; i--){
                if(v[i].opened == true)continue;
                if(nextState(v[i],v,goal)== true){
                    flag = true;
                    break;
                }
                
            }   
         
            if(flag) break;
        }
        int index = v.size()-1;
        
        vector<int>stack;
        while(true){
            if(index ==0 )break; 
            stack.push_back(v[index].from);
            index = v[index].parent;
            
        }
        int end = stack.size()-1;
        for(int j=end;j>=0;j--){
                cout<<signal[stack[j]]<<endl;
        }
        cout<<signal[SUC]<<endl;
    }
    
    return 0;
    
}
